﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<MethodInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Modify Method - Open API Control Panel
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <fieldset>
        <legend>Method Manage &gt; Modify Method</legend>
        <table border="0" cellspacing="0" width="100%">
            <tr>
                <td width="160">
                    Method Category<font color="red">*</font>
                </td>
                <td>
                    <% =Html.DropDownList("ddlMETHOD_CATEGORY", ViewData["METHOD_CATEGORY"] as SelectList, new { @style = "width:300px" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Name<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtMETHOD_NAME", Model.METHOD_NAME, new { @style = "width:300px" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Function<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtMETHOD_TEXT", Model.METHOD_TEXT, new { @style = "width:300px" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Desc
                </td>
                <td>
                    <% =Html.TextArea("editor1", Model.METHOD_DESC, new { @rows = "10", @cols = "80" })%>
                    <script type="text/javascript">
                        //<![CDATA[

                        CKEDITOR.replace('editor1',
					{
					    skin: 'kama',
					    fullPage: true,
					    htmlEncodeOutput: true,
					    toolbar:
				        [
                            ['Source', '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'],
                            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'/*, 'Print', 'SpellChecker', 'Scayt'*/],
                            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
					    //['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
                            '/',
                            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
                            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
                            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
                            ['Link', 'Unlink', 'Anchor'],
                            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
                            '/',
                            ['Styles', 'Format', 'Font', 'FontSize'],
                            ['TextColor', 'BGColor'],
                            ['Maximize', 'ShowBlocks', '-', 'About']
                        ]

					});
                        //]]>
                    </script>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Return
                </td>
                <td>
                    <% =Html.TextArea("editor2", Model.METHOD_RETURN)%>
                    <script type="text/javascript">
                        //<![CDATA[

                        CKEDITOR.replace('editor2',
					{
					    skin: 'kama',
					    fullPage: true,
					    htmlEncodeOutput: true,
					    toolbar:
				        [
                            ['Source'/*, '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'*/],
                            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'/*, 'Print', 'SpellChecker', 'Scayt'*/],
                            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
					    //['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
                            '/',
                            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
                            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
                            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
					    //  ['Link', 'Unlink', 'Anchor'],
					    // ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
					    //   '/',
					    //['Styles', 'Format', 'Font', 'FontSize'],
					    // ['TextColor', 'BGColor'],
					    // ['Maximize', 'ShowBlocks', '-', 'About']
                        ]
					});
                        //]]>
                    </script>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Display Order<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtMETHOD_ORDER", Model.METHOD_ORDER, new { @style = "width:80px" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Method Used Y/N
                </td>
                <td>
                    <% =Html.TextBox("txtUSED_YN", Model.USED_YN, new { @style = "width:80px", @maxlength = "1" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    &nbsp;
                </td>
                <td>
                    <input type="button" id="btnMethodMod" name="btnMethodMod" value="Modify Method" />
                    <input type="button" id="btnBackToList" name="btnBackToList" value="Back To List" />
                </td>
            </tr>
        </table>
    </fieldset>
    <script type="text/javascript" language="javascript">

        //json: Submit
        $().ready(function () {
            $("#btnMethodMod").click(function () {

                if (confirm('Are you sure submit?')) {

                    var category_cd = $("#ddlMETHOD_CATEGORY").val();
                    var method_name = $("input[name='txtMETHOD_NAME']").val();
                    var method_text = $("input[name='txtMETHOD_TEXT']").val();
                    var method_desc = CKEDITOR.instances.editor1.getData();
                    var method_return = CKEDITOR.instances.editor2.getData();
                    var method_order = $("input[name='txtMETHOD_ORDER']").val();
                    var used_yn = $("input[name='txtUSED_YN']").val();

                    $("input[name='btnMethodMod']")[0].disabled = "disabled";
                    $("input[name='btnMethodMod']")[0].value = "Modify Method...";

                    $.post("/Method/AjaxMod?" + new Date(), {
                        Action: "post",
                        category_cd: category_cd,
                        method_name: method_name,
                        method_text: method_text,
                        method_desc: method_desc,
                        method_return: method_return,
                        method_order: method_order,
                        used_yn: used_yn
                    }, function (result) {
                        if (result.FLAG) {
                            alert(result.DESC);
                            $("input[name='btnMethodMod']")[0].disabled = "";
                            $("input[name='btnMethodMod']")[0].value = "Modify Method";
                        }
                        else {
                            alert(result.DESC);
                            $("input[name='btnMethodMod']")[0].disabled = "";
                            $("input[name='btnMethodMod']")[0].value = "Modify Method";
                        }
                    })
                }
            })
        })

        $().ready(function () {
            $("#btnBackToList").click(function () {
                location.href = "/Method/List";
            })
        })
    </script>
</asp:Content>
